import React, {PureComponent} from 'react';
import {Form, Input, Modal, Select, Steps,TreeSelect,Button,} from 'antd';
import DescriptionList from '@/components/DescriptionList';
const {Description} = DescriptionList;
const FormItem = Form.Item;
const {Step} = Steps;
const {TextArea} = Input;
const {Option} = Select;

/***
 * 移动文件
 */
@Form.create()
class CopyFileForm extends PureComponent {

  state = {
    value: undefined,
  }

  onChange = (value) => {
    console.log(value);
    this.setState({value});
  }

  render() {
    const {modalVisible, loading, handleCopy, handleModalVisible, record, dirTreeList} = this.props;
    const okHandle = () => {
      Modal.confirm({
        title: '复制文件',
        content: '此操作较为耗时，需耐心等待',
        okText: '确认',
        cancelText: '取消',
        onOk: () => handleCopy(this.state.value, record),
      });

    };

    return (
      <Modal
        destroyOnClose
        title={'文件复制'}
        visible={modalVisible}
        onOk={okHandle}

        onCancel={() => handleModalVisible()}
        footer={[

          <Button key="go" type="primary" loading={loading} onClick={() => okHandle()}>确定</Button>
        ]}
      >
        <div style={{marginBottom:'10px'}}>目标文件夹：</div>
        <TreeSelect
          style={{width: '100%'}}
          value={this.state.value}
          dropdownStyle={{maxHeight: 400, overflow: 'auto'}}
          treeData={dirTreeList}
          placeholder="默认为根目录"
          treeDefaultExpandAll
          onChange={this.onChange}
        />

      </Modal>
    );
  }
}

export default CopyFileForm;
